package com.fpt.edu.vn.h2tv.dao.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TbBook entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tb_book", catalog = "bookdb")
public class TbBook implements java.io.Serializable {

	// Fields

	private Integer booktid;
	private String bookname;
	private String author;
	private String description;
	private Double price;
	private Short categoryid;
	private Integer quantity;
	private Long count;
	private String bookImage;
	private Timestamp updatetime;
	private Timestamp createtime;
	private List<TbTags> tbTagses = new ArrayList<TbTags>();
	private List<TbBookCategory> tbBookCategories = new ArrayList<TbBookCategory>();
	private List<TbOrderDetail> tbOrderDetails = new ArrayList<TbOrderDetail>(0);
	private List<TbComment> tbComments = new ArrayList<TbComment>(0);

	// Constructors

	/** default constructor */
	public TbBook() {
	}

	/** minimal constructor */
	public TbBook(String bookname, String author, Double price, String bookImage,
			Short categoryid, Integer quantity, Long count,
			Timestamp updatetime, Timestamp createtime) {
		this.bookname = bookname;
		this.author = author;
		this.bookImage = bookImage;
		this.price = price;
		this.categoryid = categoryid;
		this.quantity = quantity;
		this.count = count;
		this.updatetime = updatetime;
		this.createtime = createtime;
	}

	/** full constructor */
	public TbBook(String bookname, String author, String description,
			Double price,
			Short categoryid, Integer quantity, Long count,String bookImage,
			Timestamp updatetime, Timestamp createtime, List<TbTags> tbTagses,
			List<TbBookCategory> tbBookCategories,
			List<TbOrderDetail> tbOrderDetails, List<TbComment> tbComments) {
		this.bookname = bookname;
		this.author = author;
		this.description = description;
		this.price = price;
		this.categoryid = categoryid;
		this.quantity = quantity;
		this.count = count;
		this.updatetime = updatetime;
		this.createtime = createtime;
		this.tbTagses = tbTagses;
		this.tbBookCategories = tbBookCategories;
		this.tbOrderDetails = tbOrderDetails;
		this.tbComments = tbComments;
		this.bookImage =bookImage;
	}
	@Column(name = "IMAGE_URL")
	public String getBookImagel() {
        return bookImage;
    }

    public void setBookImagel(String bookImage) {
        this.bookImage = bookImage;
    }

    // Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "BOOKTID", unique = true, nullable = false)
	public Integer getBooktid() {
		return this.booktid;
	}

	public void setBooktid(Integer booktid) {
		this.booktid = booktid;
	}

	@Column(name = "BOOKNAME", nullable = false)
	public String getBookname() {
		return this.bookname;
	}

	public void setBookname(String bookname) {
		this.bookname = bookname;
	}

	@Column(name = "AUTHOR", nullable = false, length = 65535)
	public String getAuthor() {
		return this.author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	@Column(name = "DESCRIPTION", length = 65535)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "PRICE", nullable = false, precision = 10, scale = 0)
	public Double getPrice() {
		return this.price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Column(name = "CATEGORYID", nullable = false)
	public Short getCategoryid() {
		return this.categoryid;
	}

	public void setCategoryid(Short categoryid) {
		this.categoryid = categoryid;
	}

	@Column(name = "QUANTITY", nullable = false)
	public Integer getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	@Column(name = "COUNT", nullable = false, precision = 22, scale = 0)
	public Long getCount() {
		return this.count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	@Column(name = "UPDATETIME", nullable = false, length = 19)
	public Timestamp getUpdatetime() {
		return this.updatetime;
	}

	public void setUpdatetime(Timestamp updatetime) {
		this.updatetime = updatetime;
	}

	@Column(name = "CREATETIME", nullable = false, length = 19)
	public Timestamp getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Timestamp createtime) {
		this.createtime = createtime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbBook")
	public List<TbTags> getTbTagses() {
		return this.tbTagses;
	}

	public void setTbTagses(List<TbTags> tbTagses) {
		this.tbTagses = tbTagses;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbBook")
	public List<TbBookCategory> getTbBookCategories() {
		return this.tbBookCategories;
	}

	public void setTbBookCategories(List<TbBookCategory> tbBookCategories) {
		this.tbBookCategories = tbBookCategories;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbBook")
	public List<TbOrderDetail> getTbOrderDetails() {
		return this.tbOrderDetails;
	}

	public void setTbOrderDetails(List<TbOrderDetail> tbOrderDetails) {
		this.tbOrderDetails = tbOrderDetails;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbBook")
	public List<TbComment> getTbComments() {
		return this.tbComments;
	}

	public void setTbComments(List<TbComment> tbComments) {
		this.tbComments = tbComments;
	}

}